<?php
session_start();

if(!empty($_POST['submit']) && !empty($_POST['email']) && !empty($_POST['passwd']))
{
require_once('class/validateDataF.php');
require_once('Connections/conn.php');
require_once('class/LoginF.class.php');
require_once('private_chkorder.php'); 
if(verify_email($_POST['email']))
	{
	$em=$_POST['email'];
	$pwd=$_POST['passwd'];
	$loginbs=new login();
		if($loginbs->checkrecord($em,$pwd)) 
		{
			$_SESSION['custom_id'] =$loginbs->getuser_id();
   			$_SESSION['costomtype'] = $loginbs->getgrouptype();
			$_SESSION['customname']=$loginbs->getfullname();
			checkOrderPrivate();
			echo  "<meta http-equiv='refresh' content='0;URL=index.php'>";
			exit();	
		}
	else{  echo  "<meta http-equiv='refresh' content='0;URL=index.php?fail=1' >";	exit(); }
	}
}
else if(!empty($_GET['logout']))
{
	session_destroy();
	echo  "<meta http-equiv='refresh' content='0;URL=index.php' >";	exit();
}
else { echo  "<meta http-equiv='refresh' content='0;URL=index.php?fail=2' >";	exit(); }

?>
